import os
import sys

os.system('mkdir -p samples')

while True:
    directory, short = input().split()
    directory += '/tests'
    testfiles = os.listdir(directory)
    for file in testfiles:
        if 'samples' in file:
            os.system('cp ' + directory + '/' + file + ' samples/' + short + file[7:])